package MiArbol;

import org.antlr.runtime.RecognitionException;
import org.antlr.runtime.Token;

import org.antlr.runtime.TokenStream;
import org.antlr.runtime.tree.CommonTree;
import org.antlr.runtime.tree.CommonTreeAdaptor;
import org.antlr.runtime.tree.Tree;
import org.antlr.runtime.tree.TreeAdaptor;

import antlr.CommonAST;

import antlr.collections.AST;


public class MiArbol extends CommonTree {
	// Nuevo atributo

		int linea;
		int columna;
		String fich;
		
	// Constructor vacio
	public MiArbol() {
		super();
		linea=-1;
		columna=-1;
		fich= "";
	}
	// Constructor a partir de un token
	public MiArbol(Token t){
		super(t);
		linea=t.getLine();
		columna=t.getCharPositionInLine();
		fich="";
	}

	//Constructor a partir de un token y cadena
	public MiArbol(Token t,String fic){
		super(t);
		linea=t.getLine();
		columna=t.getCharPositionInLine();
		fich=fic;
	}

public MiArbol(Token t, int linea){
	super(t);
	this.linea = linea;	
}


//Redefinicion del metodo toString
@Override public String toString() {
	final String result;
	if (linea==-1){
		result = super.toString();
	}
	else{
		result = String.format("%s[L%s,c%s]", super.toString(), linea,columna);
	}
	return result;
}
	

}

